//
//  UIBarButtonItem+Extension.swift
//  weibo1
//
//  Created by changhongliang on 2017/7/23.
//  Copyright © 2017年 richinfo. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    
    convenience init(imageName:String,target: AnyObject?,action: Selector) {
        let btn = UIButton()
        btn.frame = CGRect(x: 0, y: 0, width: 30, height: 30)
        btn.setImage(UIImage(named:imageName), for:UIControlState.normal)
        btn.setImage(UIImage(named:imageName + "_highlighted"), for:UIControlState.highlighted)
        btn.addTarget(target, action: action, for: .touchUpInside)
        self.init(customView: btn)
    }
}
